﻿using System;
using System.Windows.Forms;

namespace ConsoleApplication1
{
    class Program
    {
        static WebBrowser ctl;
        static bool done;

        [STAThread]   // Important! 
        static void Main(string[] args)
        {
            ctl = new WebBrowser();
            
            ctl.DocumentCompleted += ReadCookie;
            ctl.Navigate(@"microsoft.com");

            while (!done)
                Application.DoEvents();

            Console.ReadLine();
            ctl.Dispose();
        }
            
        static void ReadCookie(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            Console.WriteLine(ctl.Document.Cookie);
            done = true;
        }
    }
}